package com.jelly.concurrency;

import java.io.IOException;


class UnresponsiveUI extends Thread{
	
	private volatile double d = 1;
	
	public UnresponsiveUI() throws IOException{
		start();
	}
	
	@Override
	public void run() {
		while(d>0){
			System.out.println("Un");
			d= d + (Math.PI+Math.E)/d;
//			yield();
		}
		try {
			System.in.read();
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}

public class ResponsiveUI extends Thread {
	private static volatile double d = 1;

	public ResponsiveUI() {
//		setDaemon(true);
		start();
	}

	@Override
	public void run() {
		while (true) {
			System.out.println("Re1");
			d = d + (Math.PI + Math.E) / d;
		}
	}
	
	public static void main(String[] args) throws IOException {
		new UnresponsiveUI();
		new ResponsiveUI();
//		System.in.read();
//		System.out.println(d);
	}
}
